{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "#import hd5py\n",
    "import numpy as np\n",
    "import random\n",
    "from scipy.spatial import distance"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Create query data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 100,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[ 79.4 -23.1]\n",
      " [ 79.2 -22.6]\n",
      " [ 79.1 -22.4]\n",
      " [ 79.  -22.1]\n",
      " [ 78.8 -21.6]\n",
      " [ 78.6 -21.1]]\n",
      "<class 'numpy.ndarray'>\n",
      "(6, 2)\n"
     ]
    }
   ],
   "source": [
    "xq = [79.4, 79.2, 79.1,79.0, 78.8, 78.6]\n",
    "yq = [-23.1, -22.6,-22.4, -22.1, -21.6, -21.1]\n",
    "qpoints = [np.array(xq),np.array(yq)]\n",
    "\n",
    "qpoints = np.array(qpoints)\n",
    "qpoints = np.transpose(qpoints)\n",
    "\n",
    "print(qpoints)\n",
    "\n",
    "print(type(qpoints))\n",
    "print(qpoints.shape)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Create target points"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 103,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[ 79.1 -23. ]\n",
      " [ 79.1 -22.5]\n",
      " [ 79.1 -22. ]\n",
      " [ 79.1 -21. ]]\n"
     ]
    }
   ],
   "source": [
    "x = [79.1, 79.1, 79.1, 79.1]\n",
    "y = [-23, -22.5, -22, -21]\n",
    "tpoints = [np.array(x),np.array(y)]\n",
    "tpoints = np.array(tpoints)\n",
    "tpoints = np.transpose(tpoints)\n",
    "\n",
    "print(tpoints)\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Find distance between points and index of smallest distance between points"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 104,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1\n",
      "2\n"
     ]
    }
   ],
   "source": [
    "def closest_node(node, nodes):\n",
    "    closest_index = distance.cdist([node], nodes).argmin()\n",
    "    closest_dist = np.min(distance.cdist([node], nodes,'euclidean'))\n",
    "    return closest_index, closest_dist\n",
    "\n",
    "close_idx = []\n",
    "min_dist = []\n",
    "for i in range(len(tpoints)):\n",
    "    close_idxT,min_distT = closest_node(tpoints[i,:], qpoints)\n",
    "    close_idx = np.append(close_idx,[close_idxT])\n",
    "    min_dist = np.append(min_dist,[min_distT])\n",
    "\n",
    "tpt_idx = np.argmin(min_dist)\n",
    "qpt_idx = int(close_idx[tpt_idx])\n",
    "print(tpt_idx)\n",
    "print(qpt_idx)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Plot query points and target points with closest points highlighted"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 105,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x7fbc0be54ac8>]"
      ]
     },
     "execution_count": 105,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAD4CAYAAADiry33AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAgAElEQVR4nO3df5yVc/7/8cdrZvohKqnJFkOytKwfQ6MiRAmFQrJltdESlaX2g2W/Waz97H7Wj/3BSqXk57ZUWiI/EipUzKQUFYo2oia/QlplXt8/rmvMlNPMnJlz5jo/nvfb7dzmnGuu68zrXHvt09X7XNfrbe6OiIhkrpyoCxARkeRS0IuIZDgFvYhIhlPQi4hkOAW9iEiGy4u6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iD4juON8GBsE/VnSsF9lJXHUPi794FPga+AD4CDdQzVah/FfQypBYKISIbLqqEbEZFspKAXEclwCnoRkQynoBcRyXAKehGRDKegFxHJcAp6EZEM9/8B5cf2+NyXBP8AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "\n",
    "fig = plt.figure\n",
    "plt.plot(tpoints[:,1],tpoints[:,0],'.-')\n",
    "plt.plot(qpoints[:,1],qpoints[:,0],'.-')\n",
    "plt.plot(tpoints[tpt_idx,1],tpoints[tpt_idx,0],'^')\n",
    "plt.plot(qpoints[qpt_idx,1],qpoints[qpt_idx,0],'*')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
